<?php
defined('BASEPATH') OR exit('No direct script access allowed');
	class Article extends CI_Controller {
		public $catalogs;
		public function __construct(){
			parent::__construct();
			$this->load->model('Article_model');//加载模型
			$this->load->model('Catalog_model');
			$this->catalogs= $this->Catalog_model->get_catalog();//调用函数
		}
		public function index(){
			$articles= $this->Article_model->get_article();
			$data = array(
				'catalogs'=>$this->catalogs,
				'articles'=>$articles,
				'catalog_id'=>0
			);
			$this->load->view('Article_index',$data);
		}
		public function view($id){
			$article=$this->Article_model->get_one($id);
			$this->Article_model->viewadd($id);
			$data=array(
				'catalogs'=>$this->catalogs,
				'article'=>$article,
				'catalog_id'=>$article->catalog_id,
				);
			$this->load->view('Article_view',$data);
		}
		public function dolist($catalog_id){
			$articles=$this->Article_model->get_catalog_id($catalog_id);
			$data=array(
				'catalogs'=>$this->catalogs,
				'articles'=>$articles,
				'catalog_id'=>$catalog_id
				);
			$this->load->view('Article_index',$data);
		}
	}
?>